Compilation of Generic Regular Path Expressions Using C++ Class Templates
نویسنده
چکیده
Various techniques for the navigation and matching of data structures using path expressions have been the subject of extensive investigations. No matter whether such techniques are based on type information, indexing, automata, it is desirable to synthesize implementations automatically, starting from a high-level description of the path expressions to be traversed. In this paper we present a library of C++ templates for the representation of regular path expressions and their compilation into efficient backtracking algorithms. The resulting code can be used to implement visitors, pattern matchers, node collectors on regular paths over possibly heterogeneous, linked data structures. The point of the paper is on the path compilation technique, which was inspired by a continuation-passing, functional semantics of the path expressions. We rely on some peculiar aspects of C++ templates to create a compilation framework that closely follows the given semantics.
منابع مشابه
Compile Time Symbolic Derivation with C++ Templates
C++ templates are already recognized as a powerful linguistic mechanism, whose usefulness transcends the realization of traditional generic containers. In the same venue, this paper reports on a somewhat surprising application of templates—for computing the symbolic derivative of expression. Specifically, we describe a software package based on templates, called SEMT, which allows the programme...
متن کاملProgramming GPUs with C++14 and Just-In-Time Compilation
Systems that comprise accelerators (e.g., GPUs) promise high performance, but their programming is still a challenge, mainly because of two reasons: 1) two distinct programming models have to be used within an application: one for the host CPU (e.g., C++), and one for the accelerator (e.g., OpenCL or CUDA); 2) using Just-In-Time (JIT) compilation and its optimization opportunities in both OpenC...
متن کاملGeneric Programming in POOMA and PETE
POOMA is a C++ framework for developing portable scientific applications for serial and parallel computers using high-level physical abstractions. PETE is the expression template library used by POOMA. This paper discusses generic programming techniques that are used to achieve flexibility and high performance in POOMA and PETE. POOMA uses an engine class that factors the data representation ou...
متن کامل3D Visualization of Class Template Diagrams for Deployed Open Source Applications
In this paper, we exploit the gre infrastructure to facilitate comprehension of generic programs written in the C++ language, including class templates, instantiated class templates and specialized class templates [16]. We evaluate our 3D visualization technique using ten deployed open source applications and provide analysis about the frequency and efficiency of generic programming in these ap...
متن کاملVariadic Templates for C++0x
Generic functions and classes typically accept a fixed number of type arguments. However, generic functions and classes that accept a variable number of type arguments have proven to be a very useful, even though there is no support for this feature in C++. Numerous foundational libraries rely on clever template and preprocessor tricks to emulate such variable-length templates. By several measu...
متن کامل